<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>https://codepen.io/Chokcoco/pen/RwxjaEj</title>
</head>
<style>
    html,
    body {
        width: 100%;
        height: 100%;
        display: flex;
        background: #000;
    }

    div {
        width: 200px;
        height: 64px;
        line-height: 64px;
        margin: auto;
        color: #fff;
        font-size: 24px;
        text-align: center;
    }

    .gradient {
        background: linear-gradient(90deg, transparent, #415eff, transparent), linear-gradient(90deg, transparent, #415eff, transparent), linear-gradient(90deg, transparent, #1e2d86, transparent);
        background-size: 100% 2px, 100% 2px, 100% calc(100% - 4px);
        background-position: 0 0, 0 calc(100% - 2px), 0 2px;
        background-repeat: no-repeat;
    }

    .border {
        position: relative;
        background: #1e2d86;
        -webkit-mask: linear-gradient(90deg, transparent, #000, transparent);
        mask: linear-gradient(90deg, transparent, #000, transparent);
    }

    .border::before {
        content: "";
        position: absolute;
        top: 0;
        left: 0;
        bottom: 0;
        right: 0;
        border-top: 2px solid #415eff;
        border-bottom: 2px solid #415eff;
        box-sizing: border-box;
    }
</style>

<body>
    <div class="gradient">苏苏苏</div>
    <div class="border">苏苏苏</div>
</body>

</html>